{
l1pte_propagate_from_guest(d, gpl1e[i], &spl1e[i]);
if ( spl1e[i] & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(spl1e[i]), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(spl1e[i]), d);
}
}
}
unsigned long new = old & ~_PAGE_RW;
if ( is_l1_shadow )
- get_page_from_l1e(mk_l1_pgentry(new), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new), d);
count++;
pt[i] = new;
unsigned long opte = *ppte;
unsigned long npte = opte & ~_PAGE_RW;
- get_page_from_l1e(mk_l1_pgentry(npte), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(npte), d);
*ppte = npte;
put_page_from_l1e(mk_l1_pgentry(opte), d);
#endif
+/************************************************************************/
+
+static inline int
+shadow_get_page_from_l1e(l1_pgentry_t l1e, struct domain *d)
+{
+ int res = get_page_from_l1e(l1e, d);
+ struct domain *owner;
+
+ if ( unlikely(!res) && IS_PRIV(d) && !shadow_mode_translate(d) &&
+ (owner = page_get_owner(pfn_to_page(l1_pgentry_to_pfn(l1e)))) &&
+ (d != owner) )
+ {
+ res = get_page_from_l1e(l1e, owner);
+ printk("tried to map page from domain %d into shadow page tables "
+ "of domain %d; %s\n",
+ owner->id, d->id, res ? "success" : "failed");
+ }
+
+ if ( unlikely(!res) )
+ perfc_incrc(shadow_get_page_fail);
+
+ return res;
+}
+
/************************************************************************/
static inline void
if ( (old_hl2e ^ new_hl2e) & (PAGE_MASK | _PAGE_PRESENT) )
{
if ( new_hl2e & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(new_hl2e), ed->domain);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new_hl2e), ed->domain);
if ( old_hl2e & _PAGE_PRESENT )
put_page_from_l1e(mk_l1_pgentry(old_hl2e), ed->domain);
}
if ( (old_spte ^ new_spte) & (PAGE_MASK | _PAGE_RW | _PAGE_PRESENT) )
{
if ( new_spte & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(new_spte), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new_spte), d);
if ( old_spte & _PAGE_PRESENT )
put_page_from_l1e(mk_l1_pgentry(old_spte), d);
}
if ( (old_spte ^ new_spte) & (PAGE_MASK | _PAGE_RW | _PAGE_PRESENT) )
{
if ( new_spte & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(new_spte), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new_spte), d);
if ( old_spte & _PAGE_PRESENT )
put_page_from_l1e(mk_l1_pgentry(old_spte), d);
}
PERFCOUNTER_CPU(shadow_status_hit_head, "hits on head of bucket" )
PERFCOUNTER_CPU(check_pagetable, "calls to check_pagetable" )
PERFCOUNTER_CPU(check_all_pagetables, "calls to check_all_pagetables" )
+PERFCOUNTER_CPU(shadow_get_page_fail, "shadow_get_page_from_l1e fails" )
PERFCOUNTER_CPU(shadow_sync_all, "calls to shadow_sync_all")
PERFCOUNTER_CPU(shadow_make_snapshot, "snapshots created")